$def with (page)

$ _x = ctx.setdefault("bodyid", "edit")

$var title: $page.title

$:macros.databarTemplate(page)

$ format = query_param('format')
$if format == 'raw':
    $var content_type: $page.content_type
    $var rawtext: $:page.body
$else:
    $:render_template("lib/view_head", page)
        <p class="small">
            <a href="$page.key?format=raw">view as rawtext</a>
            $if page.key.endswith(".css"):
            |
            <a href="#" onclick="document.location.href='http://jigsaw.w3.org/css-validator/validator?uri=' + escape(document.location.href.replace('#', '') + '?format=raw');">validate CSS</a>
        </p>

    $:macros.DisplayCode(page.body)
